﻿using Consul;
using Ocelot.Logging;
using Ocelot.Provider.Consul;
using Ocelot.Provider.Consul.Interfaces;

namespace ServiceManagement.Gateway.Extensions;

public class MyConsulServiceBuilder : DefaultConsulServiceBuilder
{


    /*    public MyConsulServiceBuilder(IHttpContextAccessor contextAccessor, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory)
            : base(contextAccessor, clientFactory, loggerFactory) { }

        protected override string GetDownstreamHost(ServiceEntry entry, Node node)
            =>entry.Service.Address;*/



    /*    protected override string GetServiceVersion(ServiceEntry entry, Node node)
        {
            return base.GetServiceVersion(entry, node);
        }*/

    /* protected override string GetDownstreamHost(ServiceEntry entry, Node node)
       => entry.Service.Address;*/
    public MyConsulServiceBuilder(IHttpContextAccessor contextAccessor, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory) : base(contextAccessor, clientFactory, loggerFactory)
    {
    }

    protected override string GetDownstreamHost(ServiceEntry entry, Node node)
    {
        return entry.Service.Address;
    }
}